#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include<QPainter>
#include<QLine>
#include<QPixmap>
#include<QImage>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    void drawPicturefun();

protected:

    void mousePressEvent(QMouseEvent *event);

    void keyPressEvent(QKeyEvent *event);


    void paintEvent(QPaintEvent *event);



private:
    Ui::Widget *ui;
    //定义画家，用来画先和图片
    QImage img;
    int startx;//起始坐标
    int starty;//终点坐标
    int step;//步长

    int height;//获取窗口宽度
    int width;//获取窗口高度

    QPixmap *pix;

public slots:

};
#endif // WIDGET_H
